﻿using DataModels.Dto;
using DataModels.Dto.Community;
using Microsoft.AspNetCore.Mvc;
using Services.Community;
using Utils;

namespace PropertyManagementWebApi.Controllers.Community
{
    public class CommunityActivitiesController(CommunityActivitiesService communityActivitiesService) : BaseController
    {
        protected readonly CommunityActivitiesService _communityActivitiesService = communityActivitiesService;

        /// <summary>
        /// 获取社区活动列表
        /// </summary>
        /// <param name="ProjectId"></param>
        /// <param name="StartTime"></param>
        /// <param name="EndTime"></param>
        /// <param name="Active">不传值为所有，true为正在进行的活动，false为结束的活动</param>
        /// <returns></returns>
        [HttpGet]
        public ResponseModel GetCommunityActivities(bool? Active, Guid? ProjectId, DateTime? StartTime, DateTime? EndTime)
        {
            return _communityActivitiesService.GetCommunityActivities(Active,ProjectId, StartTime, EndTime);
        }

        /// <summary>
        /// 获取没结束的社区活动列表
        /// </summary>
        /// <param name="ProjectId"></param>
        /// <param name="StartTime"></param>
        /// <param name="EndTime"></param>
        /// <returns></returns>
        [HttpGet]
        public ResponseModel GetCommunityActivitiesActive(Guid? ProjectId, DateTime? StartTime, DateTime? EndTime)
        {
            return _communityActivitiesService.GetCommunityActivities(true, ProjectId, StartTime, EndTime);
        }

        /// <summary>
        /// 获取已结束的社区活动列表
        /// </summary>
        /// <param name="ProjectId"></param>
        /// <param name="StartTime"></param>
        /// <param name="EndTime"></param>
        /// <returns></returns>
        [HttpGet]
        public ResponseModel GetCommunityActivitiesInvalid(Guid? ProjectId, DateTime? StartTime, DateTime? EndTime)
        {
            return _communityActivitiesService.GetCommunityActivities(false, ProjectId, StartTime, EndTime);
        }

        /// <summary>
        /// 获取参加的社区活动列表
        /// </summary>
        /// <param name="ProjectId"></param>
        /// <param name="StartTime"></param>
        /// <param name="EndTime"></param>
        /// <returns></returns>
        [HttpGet]
        public ResponseModel GetCommunityActivitiesParticipateIn(Guid? ProjectId, DateTime? StartTime, DateTime? EndTime)
        {
            return _communityActivitiesService.GetCommunityActivitiesParticipateIn(ProjectId, StartTime, EndTime);
        }

        /// <summary>
        /// 获取社区活动详情
        /// </summary>
        /// <param name="CommunityActivitiesId"></param>
        /// <returns></returns>
        [HttpGet]
        public ResponseModel GetCommunityActivitiesDetails(Guid CommunityActivitiesId)
        {
            return _communityActivitiesService.GetCommunityActivitiesDetails(CommunityActivitiesId);
        }

        /// <summary>
        /// 获取社区活动详情 根据编号
        /// </summary>
        /// <param name="ActivitiesNumber"> 活动编号</param>
        /// <returns></returns>
        [HttpGet]
        public ResponseModel GetCommunityActivitiesDetailsByA(int ActivitiesNumber)
        {
            return _communityActivitiesService.GetCommunityActivitiesDetails(ActivitiesNumber);
        }

        /// <summary>
        /// 获取社区活动评论列表
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        [HttpGet]
        public ResponseModel GetCommunityActivityComment([FromQuery] GetCommunityActivitiesDetailsInfo info)
        {
            return _communityActivitiesService.GetCommunityActivityComment(info);
        }

        /// <summary>
        /// 获取社区活动参加人列表
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        [HttpGet]
        public ResponseModel GetCommunityActivityParticipant([FromQuery] GetCommunityActivitiesDetailsInfo info)
        {
            return _communityActivitiesService.GetCommunityActivityParticipant(info);
        }


        /// <summary>
        /// 参与活动
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        [HttpPost]
        public ResponseModel CreateCommunityActivityParticipant(CreateCommunityActivityParticipantInfo info)
        {
            return _communityActivitiesService.CreateCommunityActivityParticipant(info);
        }

        /// <summary>
        /// 获取回答详情
        /// </summary>
        /// <param name="CommunityActivitiesUUID"></param>
        /// <returns></returns>
        [HttpGet]
        public ResponseModel GetAnswerDetail([GeneralRequired] Guid CommunityActivitiesUUID)
        {
            return _communityActivitiesService.GetAnswerDetail(CommunityActivitiesUUID);
        }

        /// <summary>
        /// 评论活动
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        [HttpPost]
        public ResponseModel CreateCommunityActivityComment(CreateCommunityActivityCommentInfo info)
        {
            return _communityActivitiesService.CreateCommunityActivityComment(info);
        }

        /// <summary>
        /// 根据小区、楼栋、单元获取客服联系方式 add by tianjh 20250801
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public ResponseModel GetContactProperty(ContactPropertyInfo info)
        {
            return _communityActivitiesService.GetContactProperty(info);
        }

        /// <summary>
        /// 根据小区、楼栋、单元获取获取管家信息  add by tianjh 20250802
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        [HttpPost]
        public ResponseModel GetButler(CustomerInfo info)
        {
            return _communityActivitiesService.GetButler(info);
        }

    }
}
